/**
 * @file ${file}
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @brief
 * @version 1.0
 * @date ${date}
 *
 * @copyright Copyright (c) 2022
 *
 **/
 
#pragma region
#define _CRT_SECURE_NO_WARNINGS 1
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#pragma endregion
typedef long long ll;
using namespace std;
int main()
{
    int tc;cin>>tc;
    while(tc--) {
      ll n; cin>>n;
      if((n & 1) || n < 4) {
        cout<<-1<<endl;
        continue;
      }
      else {
        ll mn = n / 6;
        int x=n%6;
        if(x==0) {
        }else if(x==2) {
          mn++;
        }else if(x==4) {
          mn++;
        }
        ll mx = n / 4;
        x = n % 4;
        if(x==0) {
        }else if(x==2) {
        }
        cout<<mn<<' '<<mx<<endl;
      }
    }

    return 0;
}